home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1769THO (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.6 KB  |  76 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import com.sun.java.swing.event.CaretEvent;
  4. import com.sun.java.swing.event.ChangeEvent;
  5. import com.sun.java.swing.event.ChangeListener;
  6. import java.awt.event.FocusEvent;
  7. import java.awt.event.FocusListener;
  8. import java.awt.event.MouseEvent;
  9. import java.awt.event.MouseListener;
  10. import java.util.EventObject;
  11.  
  12. class JTextComponent$MutableCaretEvent extends CaretEvent implements ChangeListener, MouseListener, FocusListener {
  13.    private boolean dragActive;
  14.    private int dot;
  15.    private int mark;
  16.  
  17.    JTextComponent$MutableCaretEvent(JTextComponent c) {
  18.       super(c);
  19.    }
  20.  
  21.    final void fire() {
  22.       JTextComponent c = (JTextComponent)((EventObject)this).getSource();
  23.       if (c != null) {
  24.          Caret caret = c.getCaret();
  25.          this.dot = caret.getDot();
  26.          this.mark = caret.getMark();
  27.          c.fireCaretUpdate(this);
  28.       }
  29.  
  30.    }
  31.  
  32.    public final String toString() {
  33.       return "dot=" + this.dot + "," + "mark=" + this.mark;
  34.    }
  35.  
  36.    public final int getDot() {
  37.       return this.dot;
  38.    }
  39.  
  40.    public final int getMark() {
  41.       return this.mark;
  42.    }
  43.  
  44.    public final void stateChanged(ChangeEvent e) {
  45.       if (!this.dragActive) {
  46.          this.fire();
  47.       }
  48.  
  49.    }
  50.  
  51.    public void focusGained(FocusEvent e) {
  52.       JTextComponent.access$focusedComponent((JTextComponent)((EventObject)this).getSource());
  53.    }
  54.  
  55.    public void focusLost(FocusEvent e) {
  56.    }
  57.  
  58.    public final void mousePressed(MouseEvent e) {
  59.       this.dragActive = true;
  60.    }
  61.  
  62.    public final void mouseReleased(MouseEvent e) {
  63.       this.dragActive = false;
  64.       this.fire();
  65.    }
  66.  
  67.    public final void mouseClicked(MouseEvent e) {
  68.    }
  69.  
  70.    public final void mouseEntered(MouseEvent e) {
  71.    }
  72.  
  73.    public final void mouseExited(MouseEvent e) {
  74.    }
  75. }
  76.